home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / MW MPW Binaries 1.1.1a2 / mwcPPC / MWCIncludes / Power.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-31  |  4.1 KB  |  176 lines  |  [TEXT/MMCC]

  1. /*
  2.     File:        Power.h
  3.  
  4.     Copyright:    © 1984-1993 by Apple Computer, Inc., all rights reserved.
  5.  
  6.     WARNING
  7.     This file was auto generated by the interfacer tool. Modifications
  8.     must be made to the master file.
  9.  
  10. */
  11.  
  12. #ifndef __POWER__
  13. #define __POWER__
  14.  
  15. #ifndef __TYPES__
  16. #include <Types.h>
  17. /*    #include <ConditionalMacros.h>                                */
  18. /*    #include <MixedMode.h>                                        */
  19. /*        #include <Traps.h>                                        */
  20. #endif
  21.  
  22. enum  {
  23. /* Bit positions for ModemByte */
  24.     modemOnBit                    = 0,
  25.     ringWakeUpBit                = 2,
  26.     modemInstalledBit            = 3,
  27.     ringDetectBit                = 4,
  28.     modemOnHookBit                = 5,
  29. /* masks for ModemByte */
  30.     modemOnMask                    = 0x1,
  31.     ringWakeUpMask                = 0x4,
  32.     modemInstalledMask            = 0x8,
  33.     ringDetectMask                = 0x10,
  34.     modemOnHookMask                = 0x20,
  35. /* bit positions for BatteryByte */
  36.     chargerConnBit                = 0,
  37.     hiChargeBit                    = 1,
  38.     chargeOverFlowBit            = 2,
  39.     batteryDeadBit                = 3,
  40.     batteryLowBit                = 4,
  41.     connChangedBit                = 5,
  42. /* masks for BatteryByte */
  43.     chargerConnMask                = 0x1,
  44.     hiChargeMask                = 0x2,
  45.     chargeOverFlowMask            = 0x4,
  46.     batteryDeadMask                = 0x8
  47. };
  48.  
  49. enum  {
  50.     batteryLowMask                = 0x10,
  51.     connChangedMask                = 0x20,
  52. /* commands to SleepQRec sleepQProc */
  53.     sleepRequest                = 1,
  54.     sleepDemand                    = 2,
  55.     sleepWakeUp                    = 3,
  56.     sleepRevoke                    = 4,
  57. /* SleepQRec.sleepQFlags */
  58.     noCalls                        = 1,
  59.     noRequest                    = 2,
  60.     slpQType                    = 16,
  61.     sleepQType                    = 16
  62. };
  63.  
  64. typedef char ModemByte;
  65.  
  66. typedef char BatteryByte;
  67.  
  68. typedef long PMResultCode;
  69.  
  70. typedef struct SleepQRec SleepQRec, *SleepQRecPtr;
  71.  
  72.  
  73. /*
  74.     SleepQProcs cannot be written in or called from a high-level 
  75.     language without the help of mixed mode or assembly glue because they 
  76.     use the following parameter-passing convention:
  77.  
  78.     typedef pascal long (*SleepQProcPtr)(long message, SleepQRecPtr qRecPtr);
  79.  
  80.         In:
  81.             =>     message                D0.L
  82.             =>     qRecPtr                A0.L
  83.         Out:
  84.             <=    long                D0.L
  85. */
  86.  
  87. enum  {
  88.     uppSleepQProcInfo            = kRegisterBased|RESULT_SIZE(kFourByteCode)|REGISTER_RESULT_LOCATION(kRegisterD0)|REGISTER_ROUTINE_PARAMETER(1,kRegisterD0,kFourByteCode)|REGISTER_ROUTINE_PARAMETER(2,kRegisterA0,kFourByteCode)
  89. };
  90.  
  91. #if USESROUTINEDESCRIPTORS
  92. typedef pascal long (*SleepQProcPtr)(long message, SleepQRecPtr qRecPtr);
  93.  
  94. typedef UniversalProcPtr SleepQUPP;
  95.  
  96. #define CallSleepQProc(userRoutine, message, qRecPtr)  \
  97.     CallUniversalProc((UniversalProcPtr)(userRoutine), (uppSleepQProcInfo), (cbNeeded))
  98.  
  99. #define NewSleepQProc(userRoutine)  \
  100.     (SleepQUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppSleepQProcInfo, GetCurrentISA())
  101.  
  102. #else
  103. typedef ProcPtr SleepQUPP;
  104.  
  105. #define NewSleepQProc(userRoutine)  \
  106.     (SleepQUPP)(userRoutine)
  107.  
  108. #endif
  109.  
  110. #if defined(powerc) || defined (__powerc)
  111. #pragma options align=mac68k
  112. #endif
  113. struct SleepQRec {
  114.     struct SleepQRec            *sleepQLink;
  115.     short                        sleepQType;                        /*type = 16*/
  116.     SleepQUPP                    sleepQProc;                        /*Pointer to sleep universal proc ptr*/
  117.     short                        sleepQFlags;
  118. };
  119. #if defined(powerc) || defined(__powerc)
  120. #pragma options align=reset
  121. #endif
  122.  
  123. #ifdef __cplusplus
  124. extern "C" {
  125. #endif
  126.  
  127. extern pascal OSErr DisableWUTime(void);
  128. extern pascal OSErr GetWUTime(long *WUTime, Byte *WUFlag);
  129. extern pascal OSErr SetWUTime(long WUTime);
  130. extern pascal OSErr BatteryStatus(Byte *Status, Byte *Power);
  131. extern pascal OSErr ModemStatus(Byte *Status);
  132.  
  133. #if USES68KINLINES
  134. #pragma parameter __D0 IdleUpdate
  135. #endif
  136. extern pascal long IdleUpdate(void)
  137.  ONEWORDINLINE(0xA285);
  138.  
  139. #if USES68KINLINES
  140. #pragma parameter __D0 GetCPUSpeed
  141. #endif
  142. extern pascal long GetCPUSpeed(void)
  143.  TWOWORDINLINE(0x70FF, 0xA485);
  144. extern pascal void EnableIdle(void)
  145.  TWOWORDINLINE(0x7000, 0xA485);
  146. extern pascal void DisableIdle(void)
  147.  TWOWORDINLINE(0x7001, 0xA485);
  148.  
  149. #if USES68KINLINES
  150. #pragma parameter  SleepQInstall(__A0)
  151. #endif
  152. extern pascal void SleepQInstall(SleepQRecPtr qRecPtr)
  153.  ONEWORDINLINE(0xA28A);
  154.  
  155. #if USES68KINLINES
  156. #pragma parameter  SleepQRemove(__A0)
  157. #endif
  158. extern pascal void SleepQRemove(SleepQRecPtr qRecPtr)
  159.  ONEWORDINLINE(0xA48A);
  160. extern pascal void AOn(void)
  161.  TWOWORDINLINE(0x7004, 0xA685);
  162. extern pascal void AOnIgnoreModem(void)
  163.  TWOWORDINLINE(0x7005, 0xA685);
  164. extern pascal void BOn(void)
  165.  TWOWORDINLINE(0x7000, 0xA685);
  166. extern pascal void AOff(void)
  167.  TWOWORDINLINE(0x7084, 0xA685);
  168. extern pascal void BOff(void)
  169.  TWOWORDINLINE(0x7080, 0xA685);
  170. #ifdef __cplusplus
  171. }
  172. #endif
  173.  
  174. #endif
  175.  
  176.